<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateShopComsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_coms', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('shop_id')->comment('=shops.id');
            $table->integer('brand_id')->comment('=brands.id');
            $table->integer('commodity_id')->comment('=commodities.id');
            $table->integer('commodity_attr_id')->comment('=commodity_attr.id');
            $table->unsignedInteger('stock')->comment('库存');
            $table->decimal('price')->default(0)->comment('换购价格');
            $table->tinyInteger('is_buy')->default(0)->comment('能否换购0否1能');
            $table->tinyInteger('status')->default(1)->comment('状态1上架2待还');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `shop_coms` comment '店铺商品表';");

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_coms');
    }
}
